Bullet list + DXL layout

Hello,

Is there a more efficient way of coding this? Since DOORS/RPE doesn't handle bullet lists correctly?

//https://www.ibm.com/developerworks/community/forums/html/topic?id=4725bcb5-ac1a-4ddc-85b2-77835afcef9e&ps=25


Regexp reObj = regexp "({\\\\object)|({\\\\pict)"
Regexp reBrace = regexp "[{}]"

Buffer b = create(); b = richTextWithOle obj."Object Text"   

int pos = 0;
int oleStart = 0
Buffer result = create(); result = ""
Buffer tPtr = (Buffer null)

string replace(string stringToClear, string sub, string new) {
    int offset
        int length1
        bool matchCase = true
        string s1
        string s2
         
        for (findPlainText(stringToClear, sub, offset, length1, matchCase)) {
                s1 = stringToClear[0:offset-1]
                s2 = stringToClear[offset+(length(sub)):]
                 
                stringToClear = s1 new s2
        }
        return stringToClear
}

void find_(Buffer& temp) {
        temp = replace(tempStringOf temp, "{\\*\\pn\\pnlvlbody\\pnf0\\pnindent0\\pnstart1\\pndec{\\pntxta.}}", "")
        temp = replace(tempStringOf temp, "{\\*\\pn\\pnlvlbody\\pnf0\\pnindent0\\pnstart1\\pnlcltr{\\pntxta.}}", "")
        temp = replace(tempStringOf temp, "{\\*\\pn\\pnlvlbody\\pnf0\\pnindent0\\pnstart1\\pnucltr{\\pntxta.}}", "")
        temp = replace(tempStringOf temp, "{\\*\\pn\\pnlvlbody\\pnf0\\pnindent0\\pnstart1\\pnlcrm{\\pntxta.}}", "")
        temp = replace(tempStringOf temp, "{\\*\\pn\\pnlvlbody\\pnf0\\pnindent0\\pnstart1\\pnucrm{\\pntxta.}}", "")

        temp = replace(tempStringOf temp, "\\pntext\\f0 ", "")
        temp = replace(tempStringOf temp, "\\pntext\\f1 ", "")
}

// Look for the start of an OLE object or picture
while (search(reObj, b, pos)) {
        oleStart = pos + start 0
        // add to the result the part before the OLE object

        if (oleStart > pos) {
                tPtr = b[pos:oleStart-1];
                find_(tPtr)
                combine(result, tPtr, 0);
                delete tPtr
        }

        // look for the ending brace of the OLE object
        int braceLevel = 1; // the start of the OLE had one opening brace
        int bracePos = oleStart+1;
        while (braceLevel > 0 && search(reBrace, b,bracePos)) {
                char ch = b[bracePos + start 0];
                braceLevel += (ch == '{') ? 1 : (-1);
                bracePos += 1 + end 0
        }
        if (braceLevel != 0) error "Invalid RTF!";
        pos = bracePos;
        // print "Found OLE object from " oleStart " to " bracePos "! Replacing...\n";
        // make sure you use an RTF group ({...}) here!
        // you might need to add a space otherwise
        // result += "{XXX}"
        combine(result, b, oleStart-1, bracePos+1)
}

tPtr = b[pos:];
find_(tPtr)
combine (result, tPtr, 0); // add the rest...

displayRich(tempStringOf result)

delete result
delete b
delete tPtr

EHcnck - Thu Sep 11 01:34:35 EDT 2014